<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../node_modules/@vue/runtime-dom/dist/runtime-dom.global.js"></script>
</head>
<body>
  <div id="app"></div>
  <script>

    const {createApp, h, reactive} = VueRuntimeDOM;
    // const {reactive} = VueReactivity

    let App = {
      setup(props, context) {
        // console.log('用户 setup ', props, context)
        const state = reactive({name: 'TOM'});
        const setName = () => {
          state.name = 'JERRY';
          state.name = 'ddd';
          state.name = 'ccc';
        }
        return (proxy) => {
          // console.log("setup=>render", proxy)
          
          // h('div', {a: 23})
          // h('div', {}, 'hello world')
          // h('div', h('span'))
          // h('div', {}, h('span'))
          // h('div', null, h('span'), h('span'))
          // h('div', null, 'aaa', 'bbb', 'ccc')
          // return h('button', {style: {padding: '10px', color: 'red'}}, ['hello', 'world'])
          // return h('div', {style: {padding: '10px', color: 'red'}}, h('h2', 'hello'))
          return h('h2', {style: {color: 'red'}, onClick: setName}, state.name);
        }
        // return {
        //   a: 1, 
        //   b: 45
        // }
      },
      // render(proxy) {
      //   console.log(proxy.name, proxy.age, proxy.b, proxy.c)
      //   console.log('render');
      //   return h('div', {}, 'hello world')
      // }
    }

    const app = createApp(App, {
      name: 'tom',
      age: 12
    })
    app.mount('#app');

  </script>
</body>
</html>